<?php
require_once "xpface/util/Func.class.php";
class FileDataSource implements IDataSource {
    public function getData($sourceData, $format) {
        //var_dump($data, $format);
        switch ($format) {
            case "xml":
            {
                $data = file_get_contents($sourceData);
                return simplexml_load_string($data);
                break;
            }
            case "json":
            {
                $data = file_get_contents($sourceData);
                return json_decode($data);
                break;
            }
            case "csv":
            {
                return Func::getCsv($sourceData);
                break;
            }
            default:
            {
                return $data;
                break;
            }
        }
    }
}